package leetcode_401_500;

import java.util.Arrays;

public class LeeCode_492 {
    public static void main(String[] args) {
        System.out.println(Arrays.toString(constructRectangle(4)));
    }
    private static int[] constructRectangle(int area) {
        double floor = Math.floor(Math.pow(area, 0.5));
        int mid = 1;
        while (mid != floor){
            mid++;
        }
        for (int i = mid; i >= 1; i--){
            if (area % i == 0){
                return new int[]{Math.max(i, area / i), Math.min(i, area / i)};
            }
        }
        return null;
    }
}
